#include "ConsoleManager.h"

/* PROTECTED REGION ID(Controller::ConsoleManager_customCode) ENABLED START */

#include "fixedpoint.h"
#include "ustdlib.h"

/* PROTECTED REGION END */

void ConsoleManager_Runnable_initialize(void) {
	/* PROTECTED REGION ID(Controller::ConsoleManager_RunnableInitializeFunc) ENABLED START */
	/*
	 * TODO: Put runnable initialization code here.
	 */
	/* PROTECTED REGION END */
}

void ConsoleManager_Runnable(void) {
	/* PROTECTED REGION ID(Controller::ConsoleManager_RunnableFunc) ENABLED START */
	static unsigned int time = 0;
	int32_t desiredTemperature;
	int32_t actualTemperature;
	int power;
	char s[32];
	int32_t integer;
	int32_t fraction;

	ConsoleManager_desiredTemperature_receive(&desiredTemperature);
	ConsoleManager_actualTemperature_receive(&actualTemperature);
	ConsoleManager_power_receive(&power);

	getIntegerFraction(actualTemperature, 10, &integer, &fraction);
	usprintf(s, "%d.%d, %d, %d.%d, %d%%\n", time / 10, time % 10, FIX_TO_INT(desiredTemperature), integer, fraction, power);
	ConsoleManager_console_writeString(s);
	time += 5;
	/* PROTECTED REGION END */
}
